__author__ = """Zach Seifts <zach.seifts@gmail.com>"""
__docformat__ = 'plaintext'

from AccessControl import ClassSecurityInfo
from Products.Archetypes.atapi import *
from Products.synchronicity.config import *

schema = Schema((

    TextField(
        name='description',
        widget=TextAreaWidget(
            label="Description",
            description="",
            label_msgid='synchronicity_label_description',
            description_msgid='synchronicity_help_description',
            i18n_domain='synchronicity',
        ),
        required=True,
        description="A short summary of the content",
        searchable=True,
        label="Description"
    ),

    DateTimeField(
        name='created_date',
        widget=CalendarWidget(
            label="Created Date",
            description="Date this task was created",
            label_msgid='synchronicity_label_created_date',
            description_msgid='synchronicity_help_created_date',
            i18n_domain='synchronicity',
        ),
        required=False,
        description="Date this task was created",
        label="Created Date"
    ),

    IntegerField(
        name='days_to_complete',
        widget=IntegerField._properties['widget'](
            label="Days to complete",
            description="Number of full days to complete this task. Do not put numbers seprated by a decmel, ie: 3.5. Only use integers.",
            label_msgid='synchronicity_label_days_to_complete',
            description_msgid='synchronicity_help_days_to_complete',
            i18n_domain='synchronicity',
        ),
        required=True,
        description="Number of full days to complete this task. Do not put numbers seprated by a decmel, ie: 3.5. Only use integers.",
        searchable=True,
        label="Days to complete"
    ),

    StringField(
        name='type',
        default="Feature",
        widget=SelectionWidget(
            label='Type',
            label_msgid='synchronicity_label_type',
            i18n_domain='synchronicity',
        ),
        vocabulary=["Bug", "Feature", "Tweak", "Content Update"]
    ),

    StringField(
        name='reproducibility',
        default="N/A",
        widget=SelectionWidget(
            label='Reproducibility',
            label_msgid='synchronicity_label_reproducibility',
            i18n_domain='synchronicity',
        ),
        vocabulary=["always", "sometimes", "random", "have not tried", "unable to reproduce", "N/A"]
    ),

    StringField(
        name='priority',
        default="normal",
        widget=SelectionWidget(
            label='Priority',
            label_msgid='synchronicity_label_priority',
            i18n_domain='synchronicity',
        ),
        vocabulary=["none", "low", "normal", "high", "urgant", "immediate"]
    ),

),
)

Task_schema = BaseSchema.copy() + \
    schema.copy()

class Task(BaseContent):
    """
    """
    security = ClassSecurityInfo()
    __implements__ = (getattr(BaseContent,'__implements__',()),)

    # This name appears in the 'add' box
    archetype_name = 'Task'

    meta_type = 'Task'
    portal_type = 'Task'
    allowed_content_types = []
    filter_content_types = 0
    global_allow = 0
    #content_icon = 'Task.gif'
    immediate_view = 'base_view'
    default_view = 'base_view'
    suppl_views = ()
    typeDescription = "Task"
    typeDescMsgId = 'description_edit_task'

    _at_rename_after_creation = True

    schema = Task_schema

    # Methods


registerType(Task, PROJECTNAME)